{*include file="template/admin_head.htm"*}

<table width="100%" cellpadding="0" cellspacing="0" id="containtable" class="{*$cf_controller*}">
    <tr>
        <td valign="top" bgcolor="#FFFFFF">
            <div class="wrapper">
            {*if $cf_action=='add' || $cf_action=='edit'*}
            <script type="text/javascript">
                $(function(){
                    //权限全选,全取消
                    $(".selectbox").click(function(){
                        if(this.checked){
                            $("."+this.id).attr("checked","checked");
                        }else{
                            $("."+this.id).attr("checked",false);
                        }
                    });

                    $("#act_form").submit(function(){
                        if($("#g_title").val()==''){
                            my_alert('请输入标题','Error',"$('#g_title').focus()");
                            return false;
                        }
                    });

                })



            </script>
                    <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">新增/修改权限组</span>
                        <span><a class="edit at" href="{*$cf_self_page*}?dpt={*$cf_dpt*}">权限组管理</a></span>                    </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
            <div class="p8">
                <form name="act_form" id="act_form" method="post" action="{*$form_action*}">
                    <input name="id" id="id" type="hidden" value="{*$row['g_id']*}" />
                    <input name="pid" id="pid" type="hidden" value="{*$row['g_pid']|default:$smarty['get']['pid']*}" />
                    <input name="act" id="act" type="hidden" value="{*$cf_action*}" />

                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbl tbl_nbr">
                        <tbody>
                            {*if $cf_act=='add'*}
                            <tr>
                              <td align="right">父级:</td>
                              <td align="left">{*html_options name=pid options=$grouplist selected=$row['g_gid']|default:$smarty['get']['pid']*}</td>
                            </tr>
                            {*/if*}
                            <tr>
                                <td width="15%" align="right">权限组:</td>
                                <td width="85%" align="left"><input name="g_title" type="text" id="g_title" value="{*$row['g_title']*}" size="25" maxlength="20" />
                                &nbsp;&nbsp;&nbsp;&nbsp;指定id:
                                <input name="g_id" type="text" id="g_id" value="{*$row['g_id']*}" size="10" maxlength="10"  {*if $cf_action=='edit'*} readonly="readonly" {*/if*}/></td>
                            </tr>
 <!--                           <tr>
                              <td align="right">职能权限:</td>
                              <td align="left">{*html_options name=g_type options=$cf_info_var['1'] selected=$row['g_type']*}&nbsp;&nbsp;&nbsp;&nbsp;组别：{*html_options name=g_club_type options=$cf_info_var_common['club_stype'] selected=$row['g_club_type']*}</td>
                            </tr>-->
                            
                            <tr>
                            	<td align="right">指定权限:</td>
                            	<td align="left" style="white-space:normal;">{*html_checkboxes name="g_groups" options=$grouplist checked=$row['g_groups'] separator="&nbsp;"*}</td>
                           	</tr>
                            <tr>
                                <td width="15%" align="right">说明:</td>
                                <td width="85%" align="left"><input name="g_dsc" type="text" id="g_dsc" value="{*$row['g_dsc']*}" size="40" maxlength="60" /></td>
                            </tr>
                            <tr>
                                <td align="right">权限操作:</td>
                                <td align="left">
                                    <table width="100%" border="0">
                                        {*foreach $powerlist as $key=>$item*}
                                        {*assign var=part value='part'|cat:$key*}
                                        <tr>
                                            <td align="left"><input type="checkbox" class="selectbox" name="{*$part*}" id="{*$part*}" />{*$item['controller']*}</td>
                                            <td align="left" style="white-space:normal;">{*html_checkboxes name="powers" class=$part options=$item['allow'] checked=$row['powers'] separator="&nbsp;"*}</td>
                                        </tr>
                                        {*/foreach*}
                                    </table> </td>
                            </tr>

                            <tr>
                                <td colspan="2" align="center"><input type="submit" name="Submit" class="myinput" value="提 交" />
                                    &nbsp;&nbsp;
                                    <input type="reset" name="reset" class="myinput" value="重 置" />
                                    &nbsp;&nbsp;
                                    <input type="button" name="back" class="myinput" value="返 回" onclick="window.history.back()" /></td>
                            </tr>
                        </tbody>
                    </table>
              </form>
               </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>
            {*elseif $cf_action=='viewedit'*}
            <script type="text/javascript">
                $(function(){
                    $(".openpart").toggle(
                    function(){$("."+this.id).hide();$("#"+this.id).attr("src","public/images/admin/close_part.gif")},
                    function(){$("."+this.id).show();$("#"+this.id).attr("src","public/images/admin/open_part.gif")}
                )

                    $(".box").click(
                    function(){
                        if($(this).val()>'1'){
							if($(this).attr("checked")=="checked" ){
								$("."+this.id).attr("checked","checked");
							}else{
								$("."+this.id).attr("checked",false);
							}
						}
                    }
                )
                });
            </script>
            <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">修改浏览权限<b class="blue" style="margin-left:100px; font-weight:normal;">您当前所在的组别:{*$row['g_title']*}</b></span>
						<span><a class="edit at" href="{*$cf_self_page*}?dpt={*$cf_dpt*}">权限组管理</a></span>                   
					</div>
                    <div class="contentpanelrihgt"></div>
                </div>
                

                <div class="content_table_center_style">
                    <div class="p8">
                <form name="act_form" id="act_form" method="post" action="{*$form_action*}">
                    <input name="id" id="id" type="hidden" value="{*$row['g_id']*}" />
                    <input name="act" id="act" type="hidden" value="{*$cf_action*}" />

                    <table width="100%" class="tbl tbl_nbr">
                        <thead>
                            <tr class="thd">
                                <td width="9%" align="center">&nbsp;</td>
                                <td width="9%" align="center">ID</td>
                                <td width="26%" align="center" class="thr">栏目标题</td>
                                <td width="36%" align="center" class="thr">指向地址</td>
                                <td width="20%" align="center" class="thr">&nbsp;</td>
                            </tr>
                        </thead>
                        <tbody>
                            {*foreach $menu_array as $item*}
             				{*assign var=target value=$item['menu_target']*}
                            {*assign var=common value=$item['menu_common']*}
                            {*assign var=part value='part-'|cat:$item['menu_id']*}
                            {*assign var=box value='box-'|cat:$item['menu_id']*}
                            <tr onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td align="center"><input type="checkbox" value="{*$item['menu_id']*}" name="idlist[]" class="box {*$box*}" id="{*$box*}" {*$item['checkbox']*} /></td>
                                <td align="center">{*$item['menu_id']*}</td>
                                <td><img src="public/images/admin/open_part.gif" class="openpart" id="{*$part*}" align="absmiddle" />{*$item['menu_title']*}</td>
                                <td>{*$item['menu_link']*}</td>
                                <td align="center">&nbsp;</td>
                            </tr>
                            {*foreach name=menu_part2  item=item2 from=$item['child']*}
                            {*assign var=target value=$item2['menu_target']*}
                            {*assign var=common value=$item2['menu_common']*}
                            {*assign var=box2 value='box-'|cat:$item2['menu_id']*}
                            <tr class="{*$part*}"  onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td align="center"><input type="checkbox" value="{*$item2['menu_id']*}" name="idlist[]" class="box {*$box*} {*$box2*}" id="{*$box2*}" {*$item2['checkbox']*}  /></td>
                                <td align="center">{*$item2['menu_id']*}</td>
                                <td>&nbsp;&nbsp;&nbsp;├ {*$item2['menu_title']*}</td>
                                <td>{*$item2['menu_link']*}</td>
                                <td align="center">&nbsp;</td>
                            </tr>
                            {*foreach name=menu_part3  item=item3 from=$item2['child']*}
                            {*assign var=target value=$item3['menu_target']*}
                            {*assign var=common value=$item3['menu_common']*}
                            <tr class="{*$part*}" onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td align="center"><input type="checkbox" value="{*$item3['menu_id']*}" name="idlist[]" class="{*$box*} {*$box2*}"  {*$item3['checkbox']*} /></td>
                                <td align="center">{*$item3['menu_id']*}</td>
                                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {*$item3['menu_title']*}</td>
                                <td>{*$item3['menu_link']*}</td>
                                <td align="center">&nbsp;</td>
                            </tr>
                            {*/foreach*}
                            {*/foreach*}
                            {*/foreach*}
                            <tr  height="40" onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td colspan="5" align="center">
                                    &nbsp;&nbsp;<input type="submit" name="submit_all" id="submit_all" value="提 交" class="myinput" />
                                    &nbsp;&nbsp;<input type="reset" value="重 置" class="myinput" />
                                    &nbsp;&nbsp;<input type="button" name="back" class="myinput" value="返 回" onclick="window.history.back()" /></td>
                            </tr>
                            <tr class="tft">
                                <td colspan="5">
                                    <table width="100%" border="0">
                                        <tr>
                                            <td width="9%" align="center" style="border:0;padding:0;"><!--<input type="button" name="checkall" id="checkall" class="myinput" value="全 选" />--></td>
                                            <td width="19%" align="center" style="border:0;padding:0;"></td>
                                            <td width="72%" style="border:0;padding:0;" ><div class="turnPage"><p>{*$page*}</p></div></td>
                                        </tr>
                                    </table>                                </td>
                            </tr>
                        </tbody>
                    </table>
                </form>
            </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>
			<div class="content_panel_title">
            <div class="contentpanelleft"></div>
            <div class="contentpanelcenter">
                <span class="contentpanelcenter_font">提示说明</span>            </div>
            <div class="contentpanelrihgt"></div>
        </div>
         <div class="content_table_center_style">
         
                            <div class="p8 clearfix">流程: 市塲添加->銷售經理分配->銷售審核->銷售轉換权限組</div>
        	</div>
                        <div class="content_main_bottom">
                            <div class="content_main_bottom_left"></div>
                            <div class="content_main_bottom_right"></div>
      		</div>
            
            {*elseif $cf_action=='copy'*}
            	<div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">权限組管理copy</span>
                        <!--<span><a class="edit at" href="{*$cf_self_path*}-act_copy.htm?dpt={*$cf_dpt*}">復制权限</a></span>-->
                    </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
                    <div class="p8">
                <form name="list_form" id="list_form" method="post" action="{*$cf_self_path*}-act_all.htm">
                    <input name="act" type="hidden" value="all" />
                    <table width="100%" class="tbl tbl_nbr">
                        <thead>
                            <tr class="thd">
                                <td width="6%" align="center">选择</td>
                                <td width="9%" align="center" class="thr">ID</td>
                              <td width="16%" align="center" class="thr">权限组</td>
                                <td width="24%" align="center" class="thr">说明</td>
                                <td width="10%" align="center" class="thr">职能权限</td>
                                <td colspan="4" align="center" class="thr">操作</td>
                            </tr>
                        </thead>
                        <tbody>
                            {*foreach $data_ary as $item*}                            
                            <tr onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td align="center"><!--{*$item['g_level']*}--><input type="checkbox" name="idlist[]" value="{*$item['g_id']*}" /></td>
                                <td align="center">{*$item['g_id']*}</td>
                                <td>{*$item['indent']*}<a href="admin/admin.htm?gid={*$item['g_id']*}" class="blue" target="_blank">{*$item['g_title']*}</a>{*if $item['g_club_type']*}&nbsp;({*$item['g_club_type']*}){*/if*}</td>
                                <td>{*$item['g_dsc']*}</td>
                                <td align="center">{*$cf_info_var['1'][$item['g_type']]*}</td>
                                <!--<td width="13%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_viewedit_id_{*$item['g_id']
*}.htm" class="edit">浏览权限</a>{*/if*}</td>
                                <td width="13%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_edit_id_{*$item['g_id']
*}.htm" class="edit">操作权限</a>{*/if*}</td>
                                <td width="10%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_del_id_{*$item['g_id']
*}.htm" class="del" onclick="return confirm('你确定要删除吗?')">删除</a>{*/if*}</td>
                               	-->
                              <td width="13%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_viewedit_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">浏览权限</a>{*/if*}</td>
                                <td width="8%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_edit_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">操作权限</a>{*/if*}</td>
                              <td width="8%" align="center"><a href="{*$cf_self_path*}-act_add_pid_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">新增子项</a></td>
                              <td width="6%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_del_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="del" onclick="return confirm('你确定要删除吗?')"></a>{*/if*}</td>
                      </tr>
                            {*/foreach*}

                            <tr class="tft">
                                <td colspan="9" style="padding:0;">
                                    <table width="100%" border="0">
                                                <tr>
                                                    <td width="9%" align="center" style="border:0;padding:0;"><input type="button" name="checkall" id="checkall" class="myinput" value="全 选" /></td>
                                              <td align="left" style="border:0;padding:0;">
                                        <input type="button" name="submit_all" id="submit_all" value="復制权限" class="myinput" />
                                        <input type="button" name="allmark" id="allmark" value="标 記" class="myinput" />												</td>
                                                </tr>
                                            </table></td>
                            </tr>
                        </tbody>
                    </table>
              </form>
            </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>

           	<div class="content_panel_title">
            <div class="contentpanelleft"></div>
            <div class="contentpanelcenter">
                <span class="contentpanelcenter_font">提示说明</span>            </div>
            <div class="contentpanelrihgt"></div>
        	</div>
         	<div class="content_table_center_style">
                                   <div class="p8 clearfix">                            </div>
        	</div>
             <div class="content_main_bottom">
               <div class="content_main_bottom_left"></div>
               <div class="content_main_bottom_right"></div>
      		</div>
                
            {*else*}
            <script type="text/javascript">
                $(function(){
                    $("#checkall").toggle(
                    function(){
                        select_all("idlist[]",true);
                    },
                    function(){
                        select_all("idlist[]",false);
                    }
                );
                    $("#list_form").submit(function(){
                        if(!count_select("idlist[]")){
                            my_alert('请选择id记录','Error');
                            return false;
                        };
                        if($("#alltype").val()==''){
                            my_alert('请选择操作方式','Error',"$('#alltype').focus()");
                            return false;
                        };
                        if(confirm('确定进行操作?')==false){
                            return false;
                        }
                        return true;
                    });
					
					$("#copy").click(function(){
						var select_id = count_select("idlist[]");
						if(!select_id){
							my_alert('请选择id记录','操作提示');
							return false;
						}
						//alert(select_id);
						//var type = $("#alltype").val();
						my_iframe('{*$cf_self_path*}-act_copy.htm?idlist='+select_id,'权限复制',900,500);                                
                        //return false;
					
					});
					
				$("#copy_view_power").click(function(){
					  var select_id = count_select("idlist[]");
					  if(!select_id){
						  my_alert('请选择id记录','操作提示');
						  return false;
					  }					
					  my_iframe('{*$cf_self_path*}-act_copyviewpower.htm?idlist='+select_id,'权限复制',900,500); 				  
				  });
					
				$("#add_view_power").click(function(){
					  var select_id = count_select("idlist[]");
					  if(!select_id){
						  my_alert('请选择id记录','操作提示');
						  return false;
					  }					
					  my_iframe('{*$cf_self_path*}-act_addviewpower.htm?idlist='+select_id,'权限复制',900,500); 				  
				  });
					
					$("#addp").click(function(){
						var select_id = count_select("idlist[]");
						if(!select_id){
							my_alert('请选择id记录','操作提示');
							return false;
						}						
						my_iframe('{*$cf_self_path*}-act_addpower.htm?idlist='+select_id,'添加复制',900,500);  
					});
					
					$("#delp").click(function(){
						var select_id = count_select("idlist[]");
						if(!select_id){
							my_alert('请选择id记录','操作提示');
							return false;
						}
						my_iframe('{*$cf_self_path*}-act_delpower.htm?idlist='+select_id,'删除復制',900,500);                                
                    
					});
					
                });



            </script>

           <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">权限组管理</span>
                        <!--<span><a class="edit at" href="{*$cf_self_path*}-act_copy.htm?dpt={*$cf_dpt*}">復制权限</a></span>-->
                    </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
                    <div class="p8">
                <form name="list_form" id="list_form" method="post" action="{*$cf_self_path*}-act_all.htm">
                    <input name="act" type="hidden" value="copy" />
                    <table width="100%" class="tbl tbl_nbr">
                        <thead>
                            <tr class="thd">
                                <td width="6%" align="center">选择</td>
                                <td width="9%" align="center" class="thr">ID</td>
                              <td width="16%" align="center" class="thr">权限组</td>
                                <td width="24%" align="center" class="thr">说明</td>
                                <td width="10%" align="center" class="thr">职能权限</td>
                                <td colspan="4" align="center" class="thr">操作</td>
                            </tr>
                        </thead>
                        <tbody>
                            {*foreach $data_ary as $item*}
                           
                            <tr onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#ffc'" style=" background-color:#ffffff">
                                <td align="center"><!--{*$item['g_level']*}--><input type="checkbox" name="idlist[]" value="{*$item['g_id']*}" /></td>
                                <td align="center">{*$item['g_id']*}</td>
                                <td>{*$item['indent']*}<a href="admin/admin.htm?gid={*$item['g_id']*}" class="blue" target="_blank">{*$item['g_title']*}</a>{*if $item['g_club_type']*}&nbsp;({*$item['g_club_type']*}){*/if*}</td>
                                <td>{*$item['g_dsc']*}</td>
                                <td align="center">{*$cf_info_var['1'][$item['g_type']]*}</td>
                                <!--<td width="13%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_viewedit_id_{*$item['g_id']
*}.htm" class="edit">浏览权限</a>{*/if*}</td>
                                <td width="13%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_edit_id_{*$item['g_id']
*}.htm" class="edit">操作权限</a>{*/if*}</td>
                                <td width="10%" align="center">{*if $item['g_act_power']
 !='all'*}<a href="{*$cf_self_path*}-act_del_id_{*$item['g_id']
*}.htm" class="del" onclick="return confirm('你确定要删除吗?')">删除</a>{*/if*}</td>
                               	-->
                              <td width="13%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_viewedit_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">浏览权限</a>{*/if*}</td>
                                <td width="8%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_edit_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">(修改)操作权限</a>{*/if*}</td>
                              <td width="8%" align="center"><a href="{*$cf_self_path*}-act_add_pid_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="edit">新增子项</a></td>
                              <td width="6%" align="center">{*if $item['g_level']>0*}<a href="{*$cf_self_path*}-act_del_id_{*$item['g_id']*}.htm?dpt={*$cf_dpt*}" class="del" onclick="return confirm('你确定要删除吗?')"></a>{*/if*}</td>
                      </tr>
                            {*/foreach*}

                            <tr class="tft">
                                <td colspan="9" style="padding:0;">
                                    <table width="100%" border="0">
                                                <tr>
                                                    <td width="9%" align="center" style="border:0;padding:0;"><input type="button" name="checkall" id="checkall" class="myinput" value="全 选" /></td>
                                              <td align="left" style="border:0;padding:0;">
                                        <input type="button" name="copy" id="copy" value="复制权限" class="myinput" />
                                        <input type="button" name="addp" id="addp"  value="添加权限" class="myinput" />
                                        <input type="button" name="delp" id="delp"  value="删除权限" class="myinput" />
                                        <input type="button" name="copy_browse" id="copy_view_power" value="复制浏览权限" class="myinput" />
                                        <input type="button" name="add_browse" id="add_view_power" value="添加浏览权限" class="myinput" /></td>
                                                </tr>
                                            </table></td>
                            </tr>
                        </tbody>
                    </table>
              </form>
            </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>

           	<div class="content_panel_title">
            <div class="contentpanelleft"></div>
            <div class="contentpanelcenter">
                <span class="contentpanelcenter_font">提示说明</span>            </div>
            <div class="contentpanelrihgt"></div>
        	</div>
         	<div class="content_table_center_style">
                                   <div class="p8 clearfix">                            </div>
        	</div>
             <div class="content_main_bottom">
               <div class="content_main_bottom_left"></div>
               <div class="content_main_bottom_right"></div>
      		</div>



                {*/if*}
            </div>        </td>
    </tr>
</table>
{*include file="template/admin_foot.htm"*}
